﻿
using System;
using System.Data;
using System.Collections.Generic;

namespace LDSP.BRL
{
    public partial class R_CodificationUser : BYFW.BOL.BaseEntity
    {
        public R_CodificationUser()
        {
            m_tableName = "t_r_codification_user";
            m_tblCacheManager.IsEnable = true;
        }

        protected int m_favoriteID = 0;
        protected int m_userID = 0;

        /// <summary>
        /// 收藏关系ID
        /// </summary>
        public int FavoriteID
        {
            get { return m_favoriteID; }
            set { m_favoriteID = value; }
        }
        /// <summary>
        /// 企业用户ID
        /// </summary>
        public int UserID
        {
            get { return m_userID; }
            set { m_userID = value; }
        }

        protected override void FillContainer()
        {
            base.FillContainer();
            m_container.Add("favoriteID", m_favoriteID);
            m_container.Add("userID", m_userID);
        }

        public override bool GetProperties(System.Data.DataRow record)
        {
            if (!base.GetProperties(record))
            {
                return false;
            }
            m_favoriteID = this.GetIntValue(record, "favoriteID");
            m_userID = this.GetIntValue(record, "userID");
            return true;
        }

        public void DeleteByCodification(int favoriteID)
        {
            string cond = string.Format("where {0}={1}", DB.GetCol("favoriteID"), DB.GetVal(favoriteID));
            this.DeleteRecord(null, cond);
        }
        public void DeleteByUser(int userID)
        {
            string cond = string.Format("where {0}={1}", DB.GetCol("userID"), DB.GetVal(userID));
            this.DeleteRecord(null, cond);
        }
    }
}
